package com.xiaoh.dormitoryrepairreportbackend.model.dto.ai;

import com.xiaoh.dormitoryrepairreportbackend.model.dto.user.UserResponse;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * AI推荐维修工响应
 */
@Data
@Schema(description = "AI推荐维修工响应")
public class AiRecommendationResponse implements Serializable {
    
    /**
     * AI分配结果
     */
    @Schema(description = "AI分配结果")
    private AiAssignmentResult aiResult;
    
    /**
     * 推荐的维修工列表
     */
    @Schema(description = "推荐的维修工列表")
    private List<UserResponse> recommendedWorkers;
    
    private static final long serialVersionUID = 1L;
    
    /**
     * 创建成功的推荐响应
     */
    public static AiRecommendationResponse success(AiAssignmentResult aiResult, List<UserResponse> workers) {
        AiRecommendationResponse response = new AiRecommendationResponse();
        response.setAiResult(aiResult);
        response.setRecommendedWorkers(workers);
        return response;
    }
    
    /**
     * 创建失败的推荐响应
     */
    public static AiRecommendationResponse failure(String errorMessage, List<UserResponse> fallbackWorkers) {
        AiRecommendationResponse response = new AiRecommendationResponse();
        response.setAiResult(AiAssignmentResult.failure(errorMessage));
        response.setRecommendedWorkers(fallbackWorkers);
        return response;
    }
}
